package cn.sinjinsong.eshop.common.domain.entity.order;

import cn.sinjinsong.eshop.common.domain.entity.product.ProductDO;
import cn.sinjinsong.eshop.common.domain.entity.user.UserDO;
import cn.sinjinsong.eshop.common.enumeration.order.OrderStatus;
import cn.sinjinsong.eshop.common.properties.DateTimeProperties;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDO implements Serializable{
    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.id
     *
     * @mbggenerated
     */
    private Long id;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.product
     *
     * @mbggenerated
     */
    @NotNull
    private ProductDO product;
    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.quantity
     *
     * @mbggenerated
     */
    @NotNull
    @Min(1)
    private Integer quantity;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.user
     *
     * @mbggenerated
     */
    @NotNull
    private UserDO user;
    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.place_time
     *
     * @mbggenerated
     */
    @JsonFormat(pattern = DateTimeProperties.LOCAL_DATE_TIME_PATTERN)
    private LocalDateTime placeTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.total_price
     *
     * @mbggenerated
     */
    @NotNull
    private Double totalPrice;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column order.order_status
     *
     * @mbggenerated
     */
    private OrderStatus orderStatus;
}